#!/bin/bash

R="\\033[1;31m"
V="\\033[1;32m"
J="\\033[1;33m"
N="\\033[0;39m"

if [ $USER != "root" ]; then
    echo -n "$R"
    echo -n "Doit être lancé en tant que root."
    echo "$N"
    exit 1
fi

LOG_FILE=./lamp-purge-`date +"%Y%m%d%H%M%S"`.log

touch $LOG_FILE

echo -n "Effacement de l'environnement LAMP : "

apt-get purge --quiet --yes apache2 php5 mysql-server-5.0 php5-mysql

if [ "$?" = 0 ]; then
    echo -e "$V OK $N"
else
    echo -e "$R KO $N"
    exit 1
fi
